Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am tryin to embed youtube in my webpage. I am a starter so i might be doing something wrong here. can any please help me on this. I have included the swobject.

<html>
  <script type="text/javascript" src="swfobject.js"></script>    
  <div id="ytapiplayer">
    You need Flash player 8+ and JavaScript enabled to view this video.
  </div>
  <script type="text/javascript">
    var params = { allowScriptAccess: "always" };
    var atts = { id: "myytplayer" };
    swfobject.embedSWF("http://www.youtube.com/v/VIDEO_ID?enablejsapi=1&playerapiid=ytplayer", "ytapiplayer", "425", "356", "8", null, null, params, atts);
  </script>
  <script type="text/javascript">
  function onYouTubePlayerReady(playerId) {
      ytplayer = document.getElementById("myytplayer");
  }
  </script>
  <a href="javascript:void(0);" onclick="onYouTubePlayerReady();">Play</a>
</html>
Posted
Updated 28-Apr-10 21:56pm
v2

1 solution

Why do you need a flash player to show youtube video? If no specific reason then, Just put this:
XML
<object width="425" height="350">
  <param name="movie" value="http://www.youtube.com/v/HvHOCqbA6rE">
  </param>
  <param name="wmode" value="transparent">
  </param>
  <embed src="http://www.youtube.com/v/HvHOCqbA6rE"
  type="application/x-shockwave-flash" wmode="transparent"
  width="425" height="350">
  </embed>
</object>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900